package com.evil.common.account.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * 管理员状态
 *
 * @author ly
 */
@AllArgsConstructor
public enum IsManageEnum {

    /**
     * 管理员状态
     */
    UN_MANAGE(0, "成员"),
    MANAGE(1, "主管"),
    ;

    @Getter
    private final int id;
    @Getter
    private final String name;

    public static Optional<IsManageEnum> findById(Integer id) {
        if (null == id) {
            return Optional.empty();
        }
        return Arrays.stream(values()).filter(e -> e.id == id).findFirst();
    }

}
